<?xml version="1.0" encoding="UTF-8"?>
<%@page contentType="text/html; charset=UTF-8"
		import="org.apache.commons.beanutils.BeanUtils" %>
<%
	String action = request.getParameter("action");
	if ("EDIT".equals(action)) {
		User u = new User();
		BeanUtils.copyProperties(u, SessionUtil.getUser(session));
		u.setPassword("");
		
		SessionUtil.setUserEdition(session, u);
	}
	
	User user = SessionUtil.getUserEdition(session);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
	<title>Bookstore :: <%=user%></title>
	<%@include file="include.jsp" %>
</head>

<body>
	<%@include file="commun.jsp" %>
	
	<div class="contenuAvecMenu contenuAvecOutils">
		<h2><%=user%></h2>
		<form method="post" action="SaveAccount.do" enctype="multipart/form-data">
			<div class="boite bleue">
				<p>
					<label for="password">Mot de passe</label>
					<input type="password" id="password" name="password" value="<%=user.getPassword()%>" />
				</p>
				
				<p>
					<label for="lastName">Nom</label>
					<input type="text" id="lastName" name="lastName" value="<%=user.getLastName()%>" />
				</p>
				
				<p>
					<label for="firstName">Prenom</label>
					<input type="text" id="firstName" name="firstName" value="<%=user.getFirstName()%>" />
				</p>
				
				<p>
					<label for="email">E-mail</label>
					<input type="text" id="email" name="email" value="<%=user.getEmail()%>" />
				</p>
				
				<p>
					<label for="avatar">Avatar</label>
					<input type="file" id="avatar" name="avatar" value="" />
				</p>
				
				<input type="submit" value="Sauvegarder" />
			</div>
		</form>
	</div>
</body>
</html>